home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / object oriented files / CDRVRDirector.cp < prev    next >
Encoding:
Text File  |  1993-11-04  |  3.1 KB  |  126 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CDRVRDirector.c
  3.  
  4.         
  5.     SUPERCLASS = CDLOGDirector
  6.     
  7.     Copyright © 1991 Symantec Corporation. All rights reserved.
  8.     
  9.  
  10.  ******************************************************************************/
  11.  
  12. #include "CDRVRDirector.h"
  13. #include <CScrollPane.h>
  14. #include <CDialogText.h>
  15. #include <CDialog.h>
  16. #include <CPaneBorder.h>
  17. #include <CApplication.h>
  18. #include <CTextEnvirons.h>
  19. #include <CIntegerText.h>
  20. #include "CDRVRArray.h"
  21. #include "CDRVRTable.h"
  22.  
  23. static Boolean ByKind( CView *scrollPane, void* targetID)
  24.     {
  25.     return member(scrollPane, CScrollPane);
  26.     }
  27.  
  28. static Boolean ByKind_set_text( CView *pane, void* targetID)
  29.     {
  30.     if (member(pane, CIntegerText))
  31.         {
  32.         long    **value = (long **)targetID;
  33.         ((CIntegerText *)pane)->SetIntValue(**value);
  34.         ((CIntegerText *)pane)->Specify( kNotEditable, kNotSelectable, kNotStylable);
  35.         (*value)++;
  36.         }
  37.     return false;
  38.     }
  39.  
  40. void CDRVRDirector::IDRVRDirector( short DRVRid, CDirectorOwner *aSupervisor)
  41.     {
  42.     Handle Data = GetResource( 'DRVR', DRVRid);
  43.     Str255    rName;
  44.     ResType    rType;
  45.     FailNILRes(Data);
  46.     GetResInfo(Data,&DRVRid,&rType,rName);
  47.     rName[1] = rName[0]-1;    /* get rid of initial null */
  48.     NewDocument(Data, aSupervisor, rName+1);
  49.     }
  50.  
  51. void CDRVRDirector::NewDocument( Handle Data, CDirectorOwner *aSupervisor, Str255 name)
  52.     {
  53.     CScrollPane *scrollPane;
  54.  
  55.     CDLOGDirector::IDLOGDirector( 10000, aSupervisor);
  56.     
  57.     itsData = Data;    
  58.     itsWindow->SetTitle(name);
  59.     scrollPane = (CScrollPane *)itsWindow->MatchView( ByKind, 0);
  60.  
  61.     if (scrollPane)
  62.         {
  63.         CPaneBorder *listBorder;
  64.         Rect    margin;
  65.         Cell    aCell;    
  66.         TextInfoRec    textInfo;
  67.         textInfo.fontNumber = monaco;
  68.         textInfo.theSize = 9;
  69.         textInfo.theStyle = 0;
  70.         textInfo.theMode = srcOr;          
  71.     
  72.         itsStringTable = new( CDRVRTable);
  73.         itsStringTable->IArrayPane( scrollPane, itsWindow, 0, 0, 0, 0,
  74.             sizELASTIC, sizELASTIC);
  75.         itsStringTable->FitToEnclosure( TRUE, TRUE);
  76.         itsStringTable->SetDrawActiveBorder( TRUE);
  77.         ((CTextEnvirons *)(itsStringTable->itsEnvironment))->SetTextInfo( &textInfo);        
  78.         itsStringTable->SetID( 10);
  79.  
  80.         listBorder = new( CPaneBorder);
  81.         listBorder->IPaneBorder( kBorderFrame);
  82.           
  83.         itsStringTable->SetBorder( listBorder);
  84.                 
  85.         itsStringTable->SetSelectionFlags( selOnlyOne);
  86.         
  87.         scrollPane->InstallPanorama( itsStringTable);
  88.         
  89.         itsStrings = new( CDRVRArray);
  90.         itsStrings->IResHandle( itsData );
  91.         itsStrings->Sort(TRUE);
  92.  
  93.         itsStringTable->SetArray( itsStrings, FALSE);
  94.         
  95.         SetCell( aCell, 0, 0);
  96.         itsStringTable->SelectCell( aCell, FALSE, FALSE);
  97.  
  98.         }
  99.         
  100.     if (itsStrings)
  101.         {
  102.         long    temp[10];
  103.         long    *ptr = temp;
  104.         *ptr++ = itsStrings->execp->a_text;
  105.         *ptr++ = itsStrings->execp->a_data;
  106.         *ptr++ = itsStrings->execp->a_bss;
  107.         *ptr++ = itsStrings->execp->a_syms/sizeof (struct nlist);
  108.         *ptr++ = itsStrings->execp->a_entry;
  109.         *ptr++ = itsStrings->execp->a_trsize;
  110.         *ptr++ = itsStrings->execp->a_drsize;
  111.         *ptr++ = temp[0]+temp[1]+temp[2]+
  112.                  temp[3]*sizeof (struct nlist)+
  113.                  temp[5]+temp[6];
  114.         ptr = temp;
  115.         itsWindow->MatchView( ByKind_set_text, &ptr);
  116.         }
  117.     }    /* CDRVRDirector::IDRVRDirector */
  118.  
  119.  
  120. void CDRVRDirector::Dispose( void)
  121. {
  122.     itsStrings = 0;
  123.     inherited::Dispose();
  124. }
  125.  
  126.